package com.td.core.obj;

import com.td.core.communication.Sendable;

public class TDPoint implements Sendable<TDPoint>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int x, y;
	
	public TDPoint(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public TDPoint(TDPoint tdPoint) {
		
		this(tdPoint.getX(), tdPoint.getY());
		
	}
	
	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}
	
	public void setLocation(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	@Override
	public void copyTo(TDPoint obj) {
		obj.x = this.x;
		obj.y = this.y;
	}

	@Override
	public TDPoint getCopy() {

		return new TDPoint(this);
	}
	
	@Override
	public boolean equals(Object obj) {
		
		TDPoint point = (TDPoint)obj;
		
		if(this.x == point.x && this.y == point.y)
			return true;
		return false;
	}

}
